#ifndef _NET_PCAP_SOCKET_H_
#define _NET_PCAP_SOCKET_H_


#include <string>
#include <functional>
#include <stdexcept>
#include <memory>
#include "RawIoInterface.h"

struct pcap;
typedef struct pcap pcap_t;

class NetPcapSocket : public RawIoInterface
{
public:
    explicit NetPcapSocket(const std::string& ifname);
    ~NetPcapSocket();

    virtual int SendData(DataCache& data, int timeout);
    virtual int RecvData(DataCache& data, int timeout);
private:

    pcap_t* open_if(const std::string& ifname);

private:
    pcap_t* m_handler;
};
typedef std::shared_ptr<NetPcapSocket> NetPcapSocketPtr;

#endif

